package com.wrx.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wrx.server.pojo.Bar;
import com.wrx.server.pojo.BarModel;
import com.wrx.server.pojo.BarRegisterParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wrx
 * @since 2021-04-20
 */
@Repository
public interface BarMapper extends BaseMapper<Bar> {


    /**
     * 贴吧主题帖数+1
     * @param bar_id
     * @return
     */
    public int addBarPostNumber(int bar_id);

    /**
     * 贴吧主题帖数-1
     * @param bar_id
     * @return
     */
    public int delBarPostNumber(int bar_id);

    /**
     * 贴吧关注数加1
     * @param bar_id
     * @return
     */
    public int addBarUserNumber(int bar_id);

    /**
     * 贴吧关注数减1
     * @param bar_id
     * @return
     */
    public int delBarUserNumber(int bar_id);

    /**
     * 创建一个新吧
     * @param bar
     * @return
     */
    public int insertBar(@Param("entity") Bar bar);




    public List<Bar> selBarById(int bar_id);

    /**
     * 查询是否存在同名贴吧
     * @param bar_name
     * @return
     */
    public int selBarInfoByBarName(String bar_name);

    /**
     * 根据id查询吧是否存在
     * @param bar_id
     * @return
     */
    public int selBarIdByBarId(Integer bar_id);

    /**
     * 根据主题帖id查询吧主id
     * @param theme_post_id
     * @return
     */
    public int selBarOwnerIdByThemePostId(int theme_post_id);

    /**
     * 查询全部贴吧
     * @return
     */
    public List<Bar> selAllBar();

    /**
     * 查询贴吧信息和其吧主昵称，根据bar_id
     * @param bar_id
     * @return
     */
    public List<BarModel> selBarInfoAndUserNetNameById(int bar_id);

    /**
     * 模糊搜索吧，根据吧名
     * @param searchInfo
     * @return
     */
    public List<Bar> selLikeBarByInfo(String searchInfo);


    
}
